//
//  TZTestCell.m
//  TZImagePickerController
//
//  Created by 谭真 on 16/1/3.
//  Copyright © 2016年 谭真. All rights reserved.
//

#import "TZTestCell.h"
@implementation TZTestCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        
      
        
            
            
            self.backgroundColor = [UIColor whiteColor];
            _imageView = [[UIImageView alloc] init];
            _imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];
            _imageView.contentMode = UIViewContentModeScaleAspectFill;
            [self addSubview:_imageView];
            self.clipsToBounds = YES;

        }
       
   
    return self;
}

- (void)shakeAnimationForView:(UIView *)view{
    //获取到当前的View
    CALayer *viewLayer = view.layer;
    //获取当前View位置
    CGPoint position = viewLayer.position;
    CGPoint x = CGPointMake(position.x + 10, position.y);
    CGPoint y = CGPointMake(position.x - 10, position.y);
    
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
    [animation setFromValue:[NSValue valueWithCGPoint:x]];
    [animation setToValue:[NSValue valueWithCGPoint:y]];
    [animation setAutoreverses:YES];
    [animation setDuration:0.06];
    [animation setRepeatCount:3];
    [viewLayer addAnimation:animation forKey:nil];
    
    
    
}


- (void)layoutSubviews {
    [super layoutSubviews];
    _imageView.frame = self.bounds;
}

@end
